/*
 * Compressed by JSA(www.xidea.org)
 */
var ValidationDefaultOptions = function() {
};
ValidationDefaultOptions.prototype = {
	onSubmit : true,
	onReset : true,
	stopOnFirst : false,
	immediate : false,
	focusOnError : true,
	useTitles : false,
	onFormValidate : function($, _) {
		return $
	},
	onElementValidate : function($, _) {
	}
};
var ValidatorDefaultOptions = function() {
};
ValidatorDefaultOptions.prototype = {
	ignoreEmptyValue : true,
	depends : []
};
if (typeof Prototype != "undefined" && (typeof $ != "undefined"))
	$prototype = $;
Validator = Class.create();
Validator.messageSource = {};
Validator.messageSource["en-us"] = [
		["validation-failed", "Validation failed."],
		["required", "This is a required field."],
		["validate-number", "Please enter a valid number in this field."],
		[
				"validate-digits",
				"Please use numbers only in this field. please avoid spaces or other characters such as dots or commas."],
		["validate-alpha", "Please use letters only (a-z) in this field."],
		[
				"validate-alphanum",
				"Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed."],
		["validate-email",
				"Please enter a valid email address. For example fred@domain.com ."],
		["validate-url", "Please enter a valid URL."],
		["validate-currency-dollar",
				"Please enter a valid $ amount. For example $100.00 ."],
		["validate-one-required", "Please select one of the above options."],
		["validate-integer", "Please enter a valid integer in this field"],
		["validate-pattern", "Validation failed."],
		["validate-ip", "Please enter a valid IP address"],
		["min-value", "min value is %s."],
		["max-value", "max value is %s."],
		["min-length", "min length is %s,current length is %s."],
		["max-length", "max length is %s,current length is %s."],
		["int-range", "Please enter integer value between %s and %s"],
		["float-range", "Please enter number between %s and %s"],
		["length-range",
				"Please enter value length between %s and %s,current length is %s"],
		["equals", "Conflicting with above value."],
		["less-than", "Input value must be less than above value."],
		["less-than-equal",
				"Input value must be less than or equal above value."],
		["great-than", "Input value must be great than above value."],
		["great-than-equal",
				"Input value must be great than or equal above value."],
		["validate-date", "Please use this date format: %s. For example %s."],
		["validate-selection", "Please make a selection."],
		["validate-file", function($, _, A, B) {
			return ValidationUtils.format("Please enter file type in [%s]", [A
							.join(",")])
		}],
		["validate-id-number", "Please enter a valid id number."],
		["validate-chinese", "Please enter chinese"],
		["validate-phone",
				"Please enter a valid phone number,current length is %s."],
		[
				"validate-mobile-phone",
				"Please enter a valid mobile phone,For example 13910001000.current length is %s."],
		["validate-zip", "Please enter a valid zip code."],
		["validate-qq", "Please enter a valid qq number"]];
Validator.messageSource["en"] = Validator.messageSource["en-us"];
Validator.messageSource["zh-cn"] = [
		["validation-failed", "\u9a8c\u8bc1\u5931\u8d25."],
		["required", "\u8bf7\u8f93\u5165\u503c."],
		["validate-number", "\u8bf7\u8f93\u5165\u6709\u6548\u7684\u6570\u5b57."],
		["validate-digits", "\u8bf7\u8f93\u5165\u6570\u5b57."],
		["validate-alpha", "\u8bf7\u8f93\u5165\u82f1\u6587\u5b57\u6bcd."],
		[
				"validate-alphanum",
				"\u8bf7\u8f93\u5165\u82f1\u6587\u5b57\u6bcd\u6216\u662f\u6570\u5b57,\u5176\u5b83\u5b57\u7b26\u662f\u4e0d\u5141\u8bb8\u7684."],
		[
				"validate-email",
				"\u8bf7\u8f93\u5165\u6709\u6548\u7684\u90ae\u4ef6\u5730\u5740,\u5982 username@example.com."],
		["validate-url", "\u8bf7\u8f93\u5165\u6709\u6548\u7684URL\u5730\u5740."],
		["validate-currency-dollar",
				"Please enter a valid $ amount. For example $100.00 ."],
		["validate-one-required",
				"\u5728\u524d\u9762\u9009\u9879\u81f3\u5c11\u9009\u62e9\u4e00\u4e2a."],
		["validate-integer", "\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u6574\u6570"],
		["validate-pattern", "\u8f93\u5165\u7684\u503c\u4e0d\u5339\u914d"],
		["validate-ip", "\u8bf7\u8f93\u5165\u6b63\u786e\u7684IP\u5730\u5740"],
		["min-value", "\u6700\u5c0f\u503c\u4e3a%s"],
		["max-value", "\u6700\u5927\u503c\u4e3a%s"],
		["min-length",
				"\u6700\u5c0f\u957f\u5ea6\u4e3a%s,\u5f53\u524d\u957f\u5ea6\u4e3a%s."],
		["max-length",
				"\u6700\u5927\u957f\u5ea6\u4e3a%s,\u5f53\u524d\u957f\u5ea6\u4e3a%s."],
		["int-range",
				"\u8f93\u5165\u503c\u5e94\u8be5\u4e3a %s \u81f3 %s \u7684\u6574\u6570"],
		["float-range",
				"\u8f93\u5165\u503c\u5e94\u8be5\u4e3a %s \u81f3 %s \u7684\u6570\u5b57"],
		[
				"length-range",
				"\u8f93\u5165\u503c\u7684\u957f\u5ea6\u5e94\u8be5\u5728 %s \u81f3 %s \u4e4b\u95f4,\u5f53\u524d\u957f\u5ea6\u4e3a%s"],
		["equals",
				"\u4e24\u6b21\u8f93\u5165\u4e0d\u4e00\u81f4,\u8bf7\u91cd\u65b0\u8f93\u5165"],
		["less-than", "\u8bf7\u8f93\u5165\u5c0f\u4e8e\u524d\u9762\u7684\u503c"],
		["less-than-equal",
				"\u8bf7\u8f93\u5165\u5c0f\u4e8e\u6216\u7b49\u4e8e\u524d\u9762\u7684\u503c"],
		["great-than", "\u8bf7\u8f93\u5165\u5927\u4e8e\u524d\u9762\u7684\u503c"],
		["great-than-equal",
				"\u8bf7\u8f93\u5165\u5927\u4e8e\u6216\u7b49\u4e8e\u524d\u9762\u7684\u503c"],
		[
				"validate-date",
				"\u8bf7\u8f93\u5165\u6709\u6548\u7684\u65e5\u671f,\u683c\u5f0f\u4e3a %s. \u4f8b\u5982:%s."],
		["validate-selection", "\u8bf7\u9009\u62e9."],
		["validate-file", function($, _, A, B) {
			return ValidationUtils
					.format(
							"\u6587\u4ef6\u7c7b\u578b\u5e94\u8be5\u4e3a[%s]\u5176\u4e2d\u4e4b\u4e00",
							[A.join(",")])
		}],
		["validate-id-number",
				"\u8bf7\u8f93\u5165\u5408\u6cd5\u7684\u8eab\u4efd\u8bc1\u53f7\u7801"],
		["validate-chinese", "\u8bf7\u8f93\u5165\u4e2d\u6587"],
		[
				"validate-phone",
				"\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u7535\u8bdd\u53f7\u7801,\u5982:010-29392929,\u5f53\u524d\u957f\u5ea6\u4e3a%s."],
		[
				"validate-mobile-phone",
				"\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u624b\u673a\u53f7\u7801,\u5f53\u524d\u957f\u5ea6\u4e3a%s."],
		["validate-zip",
				"\u8bf7\u8f93\u5165\u6709\u6548\u7684\u90ae\u653f\u7f16\u7801"],
		["validate-qq", "\u8bf7\u8f93\u5165\u6709\u6548\u7684QQ\u53f7\u7801."]];
ValidationUtils = {
	isVisible : function($) {
		while ($ && $.tagName != "BODY") {
			if (!$prototype($).visible())
				return false;
			$ = $.parentNode
		}
		return true
	},
	getReferenceForm : function($) {
		while ($ && $.tagName != "BODY") {
			if ($.tagName == "FORM")
				return $;
			$ = $.parentNode
		}
		return null
	},
	getInputValue : function($) {
		var $ = $prototype($);
		if ($.type.toLowerCase() == "file")
			return $.value;
		else
			return $F($)
	},
	getElmID : function($) {
		return $.id ? $.id : $.name
	},
	format : function(_, A) {
		A = A || [];
		ValidationUtils.assert(A.constructor == Array,
				"ValidationUtils.format() arguement 'args' must is Array");
		var $ = _;
		for (var B = 0; B < A.length; B++)
			$ = $.replace(/%s/, A[B]);
		return $
	},
	getArgumentsByClassName : function(B, C) {
		if (!C || !B)
			return [];
		var _ = new RegExp(B + "-(\\S+)"), D = C.match(_);
		if (!D)
			return [];
		var $ = [];
		$.singleArgument = D[1];
		var A = D[1].split("-");
		for (var E = 0; E < A.length; E++)
			if (A[E] == "") {
				if (E + 1 < A.length)
					A[E + 1] = "-" + A[E + 1]
			} else
				$.push(A[E]);
		return $
	},
	assert : function(A, _) {
		var $ = _ || ("assert failed error,condition=" + A);
		if (!A) {
			alert($);
			throw new Error($)
		} else
			return A
	},
	isDate : function($, F) {
		var H = "MM", A = "dd", D = "yyyy", B = "^"
				+ F.replace(D, "\\d{4}").replace(H, "\\d{2}").replace(A,
						"\\d{2}") + "$";
		if (!new RegExp(B).test($))
			return false;
		var E = $.substr(F.indexOf(D), 4), C = $.substr(F.indexOf(H), 2), G = $
				.substr(F.indexOf(A), 2), _ = new Date(ValidationUtils.format(
				"%s/%s/%s", [E, C, G]));
		return (parseInt(C, 10) == (1 + _.getMonth()))
				&& (parseInt(G, 10) == _.getDate())
				&& (parseInt(E, 10) == _.getFullYear())
	},
	fireSubmit : function($) {
		var $ = $prototype($);
		if ($.fireEvent) {
			if ($.fireEvent("onsubmit"))
				$.submit()
		} else if (document.createEvent) {
			var _ = document.createEvent("HTMLEvents");
			_.initEvent("submit", false, true);
			$.dispatchEvent(_)
		}
	},
	getLanguage : function() {
		var $ = null;
		if (typeof navigator.userLanguage == "undefined")
			$ = navigator.language.toLowerCase();
		else
			$ = navigator.userLanguage.toLowerCase();
		return $
	},
	getMessageSource : function() {
		var A = ValidationUtils.getLanguage(), _ = Validator.messageSource["zh-cn"];
		if (Validator.messageSource[A])
			_ = Validator.messageSource[A];
		var $ = {};
		for (var B = 0; B < _.length; B++)
			$[_[B][0]] = _[B][1];
		return $
	},
	getI18nMsg : function($) {
		return ValidationUtils.getMessageSource()[$]
	}
};
Validator.prototype = {
	initialize : function(_, $, A) {
		this.options = Object.extend(new ValidatorDefaultOptions(), A || {});
		this._test = $ ? $ : function($, _) {
			return true
		};
		this._error = ValidationUtils.getI18nMsg(_) ? ValidationUtils
				.getI18nMsg(_) : ValidationUtils
				.getI18nMsg("validation-failed");
		this.className = _;
		this._dependsTest = this._dependsTest.bind(this);
		this.testAndGetError = this.testAndGetError.bind(this);
		this.testAndGetDependsError = this.testAndGetDependsError.bind(this)
	},
	_dependsTest : function($, _) {
		if (this.options.depends && this.options.depends.length > 0) {
			var A = $A(this.options.depends).all(function(A) {
						return Validation.get(A).test($, _)
					});
			return A
		}
		return true
	},
	test : function(_, A) {
		if (!this._dependsTest(_, A))
			return false;
		if (!A)
			A = {};
		var $ = (this.options.ignoreEmptyValue && ((_ == null) || (_.length == 0)));
		return $
				|| this._test(_, A, ValidationUtils.getArgumentsByClassName(
								this.className, A.className), this)
	},
	testAndGetDependsError : function($, _) {
		var B = this.options.depends;
		if (B && B.length > 0) {
			var A = null;
			for (var C = 0; C < B.length; C++) {
				A = Validation.get(B[C]).testAndGetError($, _);
				if (A)
					return A
			}
		}
		return null
	},
	testAndGetError : function(A, B, C) {
		var D = this.testAndGetDependsError(A, B);
		if (D)
			return D;
		if (!B)
			B = {};
		var _ = (this.options.ignoreEmptyValue && ((A == null) || (A.length == 0))), $ = _
				|| this._test(A, B, ValidationUtils.getArgumentsByClassName(
								this.className, B.className), this);
		if (!$)
			return this.error(A, B, C);
		return null
	},
	error : function($, A, B) {
		var C = ValidationUtils.getArgumentsByClassName(this.className,
				A.className), _ = this._error;
		if (typeof _ == "string") {
			if ($)
				C.push($.length);
			_ = ValidationUtils.format(this._error, C)
		} else if (typeof _ == "function")
			_ = _($, A, C, this);
		else
			alert("property \"_error\" must type of string or function,current type:"
					+ typeof _ + " current className:" + this.className);
		if (!B)
			B = A.className.indexOf("useTitle") >= 0;
		return B ? ((A && A.title) ? A.title : _) : _
	}
};
var Validation = Class.create();
Validation.prototype = {
	initialize : function(A, F) {
		this.options = Object.extend(new ValidationDefaultOptions(), F || {});
		this.form = $prototype(A);
		var B = ValidationUtils.getElmID($prototype(A));
		Validation.validations[B] = this;
		if (this.options.onSubmit)
			Event.observe(this.form, "submit", this.onSubmit.bind(this), false);
		if (this.options.onReset)
			Event.observe(this.form, "reset", this.reset.bind(this), false);
		if (this.options.immediate) {
			var _ = this.options.useTitles, C = this.options.onElementValidate, D = $A(Form
					.getElements(this.form));
			for (var E = 0; E < D.length; E++) {
				var $ = D[E];
				Event.observe($, "blur", function($) {
							Validation.validateElement(Event.element($), {
										useTitle : _,
										onElementValidate : C
									})
						})
			}
		}
	},
	onSubmit : function($) {
		if (!this.validate()) {
			Event.stop($)
		} else {
			var els = document.getElementsByTagName("input");
			for (i = 0; i < els.length; i++) {
				if (els[i].type == 'submit') {
					els[i].disabled = true;
					els[i].value="正在提交...";
				}
			}
		}
	},
	validate : function() {
		var $ = true, _ = this.options.useTitles, B = this.options.onElementValidate;
		if (this.options.stopOnFirst) {
			var D = $A(Form.getElements(this.form));
			for (var E = 0; E < D.length; E++) {
				var A = D[E];
				$ = Validation.validateElement(A, {
							useTitle : _,
							onElementValidate : B
						});
				if (!$)
					break
			}
		} else {
			D = $A(Form.getElements(this.form));
			for (E = 0; E < D.length; E++) {
				A = D[E];
				if (!Validation.validateElement(A, {
							useTitle : _,
							onElementValidate : B
						}))
					$ = false
			}
		}
		if (!$ && this.options.focusOnError) {
			var C = Form.getElements(this.form).findAll(function($) {
						return $prototype($).hasClassName("validation-failed")
					})[0];
			if (C.select)
				C.select();
			C.focus()
		}
		return this.options.onFormValidate($, this.form)
	},
	reset : function() {
		var $ = $A(Form.getElements(this.form));
		for (var _ = 0; _ < $.length; _++)
			Validation.reset($[_])
	}
};
Object.extend(Validation, {
			validateElement : function($, D) {
				D = Object.extend({
							useTitle : false,
							onElementValidate : function($, _) {
							}
						}, D || {});
				$ = $prototype($);
				var A = $A($.classNames());
				for (var C = 0; C < A.length; C++) {
					var B = A[C], _ = Validation.test(B, $, D.useTitle);
					D.onElementValidate(_, $);
					if (!_)
						return false
				}
				return true
			},
			newErrorMsgAdvice : function(A, $, B) {
				var C = "<div class=\"validation-advice\" id=\"advice-" + A
						+ "-" + ValidationUtils.getElmID($)
						+ "\" style=\"display:none\">" + B + "</div>";
				switch ($.type.toLowerCase()) {
					case "checkbox" :
					case "radio" :
						var _ = $.parentNode;
						if (_)
							new Insertion.Bottom(_, C);
						else
							new Insertion.After($, C);
						break;
					default :
						new Insertion.After($, C)
				}
				C = $prototype("advice-" + A + "-"
						+ ValidationUtils.getElmID($));
				return C
			},
			showErrorMsg : function(_, $, B) {
				var $ = $prototype($);
				if (typeof Tooltip != "undefined") {
					if (!$.tooltip)
						$.tooltip = new Tooltip($, {
									backgroundColor : "#FC9",
									borderColor : "#C96",
									textColor : "#000",
									textShadowColor : "#FFF"
								});
					$.tooltip.content = B
				} else {
					var A = Validation._getAdviceProp(_), C = Validation
							.getAdvice(_, $);
					if (!$[A])
						if (!C)
							C = Validation.newErrorMsgAdvice(_, $, B);
					if (C && !C.visible())
						if (typeof Effect == "undefined")
							C.style.display = "";
						else
							new Effect.Appear(C, {
										duration : 1
									});
					C.innerHTML = B;
					$[A] = true
				}
				$.removeClassName("validation-passed");
				$.addClassName("validation-failed")
			},
			hideErrorMsg : function(_, $) {
				var $ = $prototype($);
				if (typeof Tooltip != "undefined") {
					if ($.tooltip) {
						$.tooltip.stop();
						$.tooltip = false
					}
				} else {
					var A = Validation._getAdviceProp(_), B = Validation
							.getAdvice(_, $);
					if (B && $[A])
						if (typeof Effect == "undefined")
							B.hide();
						else
							new Effect.Fade(B, {
										duration : 1
									});
					$[A] = false
				}
				$.removeClassName("validation-failed");
				$.addClassName("validation-passed")
			},
			_getAdviceProp : function($) {
				return "__advice" + $
			},
			test : function(B, _, A) {
				var $ = Validation.get(B), C = null;
				if (ValidationUtils.isVisible(_))
					C = $.testAndGetError(ValidationUtils.getInputValue(_), _,
							A);
				if (C) {
					Validation.showErrorMsg(B, _, C);
					return false
				} else {
					Validation.hideErrorMsg(B, _);
					return true
				}
			},
			getAdvice : function(_, $) {
				return $prototype("advice-" + _ + "-"
						+ ValidationUtils.getElmID($))
						|| $prototype("advice-" + ValidationUtils.getElmID($))
			},
			reset : function($) {
				$ = $prototype($);
				var _ = $A($.classNames());
				for (var D = 0; D < _.length; D++) {
					var B = _[D], A = Validation._getAdviceProp(B);
					if ($[A]) {
						var C = Validation.getAdvice(B, $);
						C.hide();
						$[A] = ""
					}
					$.removeClassName("validation-failed");
					$.removeClassName("validation-passed")
				}
			},
			add : function(_, $, C) {
				var B = {}, A = $;
				if ($ instanceof RegExp)
					A = function(_, A, B, C) {
						return $.test(_)
					};
				B[_] = new Validator(_, A, C);
				Object.extend(Validation.methods, B)
			},
			addAllThese : function($) {
				var $ = $A($);
				for (var A = 0; A < $.length; A++) {
					var _ = $[A];
					Validation.add(_[0], _[1], (_.length > 2 ? _[2] : {}))
				}
			},
			get : function($) {
				var _;
				for (var A in Validation.methods) {
					if ($ == A) {
						_ = A;
						break
					}
					if ($.indexOf(A) >= 0)
						_ = A
				}
				return Validation.methods[_]
						? Validation.methods[_]
						: new Validator()
			},
			$ : function($) {
				return Validation.validations[$]
			},
			methods : {},
			validations : {}
		});
Validation.addAllThese([
		["required", function($) {
			return !(($ == null) || ($.length == 0) || /^[\s|\u3000]+$/.test($))
		}, {
			ignoreEmptyValue : false
		}],
		["validate-number", function($) {
					return (!isNaN($) && !/^\s+$/.test($))
				}],
		["validate-digits", function($) {
					return !/[^\d]/.test($)
				}],
		["validate-alphanum", function($) {
					return !/\W/.test($)
				}],
		["validate-one-required", function($, _) {
					var A = _.parentNode, B = A.getElementsByTagName("INPUT");
					return $A(B).any(function($) {
								return $F($)
							})
				}, {
					ignoreEmptyValue : false
				}],
		["validate-digits", /^[\d]+$/],
		["validate-alphanum", /^[a-zA-Z0-9]+$/],
		["validate-alpha", /^[a-zA-Z]+$/],
		["validate-email", /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/],
		[
				"validate-url",
				/^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)((\.|:)[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i],
		[
				"validate-currency-dollar",
				/^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/]]);
Validation.addAllThese([
		["equals", function($, _, A, B) {
					return $F(A[0]) == $
				}, {
					ignoreEmptyValue : false
				}],
		["less-than", function($, _, A, B) {
			if (Validation.get("validate-number").test($)
					&& Validation.get("validate-number").test($F(A[0])))
				return parseFloat($) < parseFloat($F(A[0]));
			return $ < $F(A[0])
		}],
		["less-than-equal", function($, _, A, B) {
			if (Validation.get("validate-number").test($)
					&& Validation.get("validate-number").test($F(A[0])))
				return parseFloat($) <= parseFloat($F(A[0]));
			return $ < $F(A[0]) || $ == $F(A[0])
		}],
		["great-than", function($, _, A, B) {
			if (Validation.get("validate-number").test($)
					&& Validation.get("validate-number").test($F(A[0])))
				return parseFloat($) > parseFloat($F(A[0]));
			return $ > $F(A[0])
		}],
		["great-than-equal", function($, _, A, B) {
			if (Validation.get("validate-number").test($)
					&& Validation.get("validate-number").test($F(A[0])))
				return parseFloat($) >= parseFloat($F(A[0]));
			return $ > $F(A[0]) || $ == $F(A[0])
		}],
		["min-length", function($, _, A, B) {
					return $.length >= parseInt(A[0])
				}],
		["max-length", function($, _, A, B) {
					return $.length <= parseInt(A[0])
				}],
		["validate-file", function($, _, A, B) {
					return $A(A).any(function(_) {
								return new RegExp("\\." + _ + "$", "i").test($)
							})
				}],
		["float-range", function($, _, A, B) {
			return (parseFloat($) >= parseFloat(A[0]) && parseFloat($) <= parseFloat(A[1]))
		}, {
			depends : ["validate-number"]
		}],
		["int-range", function($, _, A, B) {
			return (parseInt($) >= parseInt(A[0]) && parseInt($) <= parseInt(A[1]))
		}, {
			depends : ["validate-integer"]
		}],
		["length-range", function($, _, A, B) {
					return ($.length >= parseInt(A[0]) && $.length <= parseInt(A[1]))
				}],
		["max-value", function($, _, A, B) {
					return parseFloat($) <= parseFloat(A[0])
				}, {
					depends : ["validate-number"]
				}],
		["min-value", function($, _, A, B) {
					return parseFloat($) >= parseFloat(A[0])
				}, {
					depends : ["validate-number"]
				}],
		["validate-pattern", function(v, elm, args, metadata) {
					return eval("(" + args.singleArgument + ".test(v))")
				}],
		["validate-ajax", function($, A, B, F) {
			var _ = ValidationUtils.getReferenceForm(A), E = (_ ? Form
					.serialize(_) : Form.Element.serialize(A));
			E += ValidationUtils.format("&what=%s&value=%s", [A.name,
							encodeURIComponent($)]);
			var C = new Ajax.Request(B.singleArgument, {
						parameters : E,
						asynchronous : false,
						method : "get"
					}), D = C.transport.responseText;
			if ("" == D.strip())
				return true;
			F._error = D;
			return false
		}],
		["validate-dwr", function(v, elm, args, metadata) {
					var result = false, callback = function($) {
						if ($)
							metadata._error = $;
						else
							result = true
					}, call = args.singleArgument + "('" + v + "',callback)";
					DWREngine.setAsync(false);
					eval(call);
					DWREngine.setAsync(true);
					return result
				}],
		["validate-buffalo", function(A, B, C, E) {
					var _ = false, D = function($) {
						if (replay.getResult())
							E._error = replay.getResult();
						else
							_ = true
					};
					if (!BUFFALO_END_POINT)
						alert("not found \"BUFFALO_END_POINT\" variable");
					var $ = new Buffalo(BUFFALO_END_POINT, false);
					$.remoteCall(C.singleArgument, A, D);
					return _
				}],
		["validate-date", function($, _, A, C) {
			var B = A.singleArgument || "yyyy-MM-dd";
			C._error = ValidationUtils.format(ValidationUtils
							.getI18nMsg(C.className), [
							B,
							B.replace("yyyy", "2006").replace("MM", "03")
									.replace("dd", "12")]);
			return ValidationUtils.isDate($, B)
		}],
		["validate-selection", function($, _, A, B) {
			return _.options
					? _.selectedIndex > 0
					: !(($ == null) || ($.length == 0))
		}],
		["validate-integer", /^[-+]?[1-9]\d*$|^0$/],
		[
				"validate-ip",
				/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/],
		["validate-id-number", function(_, B, C, G) {
			if (!(/^\d{17}(\d|x)$/i.test(_) || /^\d{15}$/i.test(_)))
				return false;
			var D = parseInt(_.substr(0, 2));
			if ((D < 11) || (D > 91))
				return false;
			var F = _.length == 18 ? _ : _.substr(0, 6) + "19"
					+ _.substr(6, 15), $ = F.substr(6, 8);
			if (!ValidationUtils.isDate($, "yyyyMMdd"))
				return false;
			if (_.length == 18) {
				_ = _.replace(/x$/i, "a");
				var A = 0;
				for (var E = 17; E >= 0; E--)
					A += (Math.pow(2, E) % 11) * parseInt(_.charAt(17 - E), 11);
				if (A % 11 != 1)
					return false
			}
			return true
		}], ["validate-chinese", /^[\u4e00-\u9fa5]+$/],
		["validate-phone", /^((0[1-9]{3})?(0[12][0-9])?[-])?\d{6,8}$/],
		["validate-mobile-phone", /(^0?[1][358][0-9]{9}$)/],
		["validate-zip", /^[1-9]\d{5}$/], ["validate-qq", /^[1-9]\d{4,8}$/]]);
Validation.autoBind = function() {
	var A = $A(document.getElementsByClassName("required-validate"));
	for (var B = 0; B < A.length; B++) {
		var $ = A[B], _ = new Validation($, {
					immediate : true,
					useTitles : true,
					stopOnFirst : true
				});
		Event.observe($, "reset", function() {
					_.reset()
				}, false)
	}
};
Event.observe(window, "load", Validation.autoBind, false)